﻿using System.Collections.Generic;
namespace LitTools
{
    /// <summary>
    /// 对象池
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ObjectPool<T> : BasePool<T> where T : IObjectPoolItem, new()
    {
        protected override T CreateObject(params object[] args)
        {
            T instance = new T();
            instance.OnCreate(args);
            return instance;
        }

        protected override void OnRent(T instance,params object[] args)
        {
            instance.OnRent(args);
        }

        protected override void OnRecycle(T instance)
        {
            instance.OnRecycle();
        }

        protected override void OnRelease(T instance)
        {
            instance.OnRecycle();
        }
    }
}